Repository navigation
feat(static-assets): add PrivateStaticAssetsConstruct (private bucket, CloudFront OAC, optional DNS, immutable deployment) - #116
Conversation
…and OAC distribution
…utoData docs - mkdocs nav, README, docs index, CLAUDE.md and the Testing guide (builder and assertions) for the new construct - construct page: CloudFront certificates must be in us-east-1; DESTROY cannot delete a non-empty versioned bucket; neutral example heading - Testing guide and Cognito page: replace the AutoFixture *AutoData attribute sections (removed with the test-project migration in #109) with a note on the library's Compono profiles Refs #111 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review — focus: (1) security of the bucket and its access: Block Public Access, SSL-only, OAC-only access with the bucket policy scoped to this distribution's |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8833ffd7fa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| certificate = domain.Certificate | ||
| ?? new Certificate(this, $"{id}-certificate", new CertificateProps |
There was a problem hiding this comment.
Reject automatic certificate creation outside us-east-1
When a custom domain supplies a hosted zone but no certificate in a stack outside us-east-1, this creates the certificate in the stack's region and passes it directly to CloudFront. CloudFront requires viewer ACM certificates in us-east-1, so this configuration produces an undeployable distribution. Although the construct page documents the regional restriction, ResolveDomain does not enforce it. Reject a known non-us-east-1 stack region before creating the certificate, with an error directing callers to supply a certificate from us-east-1, or explicitly create the certificate in that region.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 134c34d: when no Certificate is supplied and the stack region is resolved and not us-east-1, construction now throws ArgumentException directing callers to supply a us-east-1 certificate. A supplied certificate is accepted in any region; an environment-agnostic stack (unresolved region) cannot be checked at synthesis and keeps the previous behavior (documented). Test-first: Construct_ShouldThrowWhenCreatingCertificateOutsideUsEast1 observed failing (no exception thrown) before the fix; 655 tests pass per TFM; existing goldens unchanged.
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Closes #111
Beads:
cdkc-2lh.4(epiccdkc-2lh). Design:docs/designs/v3-modernization.md§8 (owner-approved 2026-11-24, namePrivateStaticAssetsConstruct).Summary
A new
PrivateStaticAssetsConstructfor immutable, versioned web assets behind CloudFront.StaticSiteConstructis unchanged.RemovalPolicyis configurable and defaults toRETAIN; no auto-delete.S3BucketOrigin.WithOriginAccessControl; the bucket policy grantscloudfront.amazonaws.coms3:GetObjectconditioned on this distribution'sAWS:SourceArn.HTTPS_ONLYby default (redirect optional),CACHING_OPTIMIZEDby default (configurable), optional comment.PrivateStaticAssetsDomainOptions, off by default):HostedZoneorHostedZoneNamelookup) to create one;BucketDeploymentfromAssetPath, with:DestinationKeyPrefix;Prune(default false) andRetainOnDelete(default true);CacheControl(default none);InvalidationPaths.Bucket,DistributionandDomainName(the first custom domain, otherwise the CloudFront domain).PrivateStaticAssetsConstructAssertionsandPrivateStaticAssetsConstructPropsBuilder.game/<version>/, no prune, retain and immutable cache-control example that 3.0.0: downstream compatibility validation (Jedi Duel, Sharedale) and stable release #112 checks);Also fixed (stale docs from #109): the Testing guide and the Cognito page still showed the AutoFixture
*AutoDataattributes, which were deleted with the test migration. They now describe the library's Compono profiles.Golden templates
private-static-assets-default.jsonandprivate-static-assets-custom-domain.json.git diff --diff-filter=M --name-only 53607ealists only Claude's doc edits.Validation (actually run)
Template has 0 resources with type AWS::S3::Bucket, then OAC/policy, SPA/error responses, deployment and DNS each failed before implementation. Cache-control "none" was caught by a test after an empty array producedcache-control: "".f0c5191:dotnet build LayeredCraft.Cdk.Constructs.slnx -c Release: 0 warnings, 0 errors;dotnet test --solution …: net10.0 651, net11.0 651 passed, 0 failed.git merge-treereports no conflicts. On the combined tree, the build had 0 warnings and 674 tests passed per TFM, 0 failed (throwaway worktree, removed afterwards).git diff --check: clean.main).Test-stack audit
PrivateStaticAssetsConstructPropsProfile. No new packages.GoldenTemplateharness. Compono does not provide CloudFormation template diffing.Notes for the owner
us-east-1, andDESTROYcan't delete a non-empty versioned bucket.Orchestration
openrouter/deepseek/deepseek-v4.1-flash) in an isolated worktree, limited to new files. The required reads were observed in the worker log.🤖 Generated with Claude Code